import styles from "@pages/personal/styles/styles.module.less";
import GeekIcon from "@shared/geekIcon";
import Header from "@shared/header";
import Back from "@shared/back";
import { useRequestProfileQuery } from "@store/service/user";
import Loading from "@shared/loading";
import Avatar from "@pages/personal/widgets/avatar";
import Nickname from "@pages/personal/widgets/nickname";
import Intro from "@pages/personal/widgets/intro";
import Gender from "@pages/personal/widgets/gender";
import Birthday from "@pages/personal/widgets/birthday";
import Logout from "@pages/personal/widgets/logout";


export default function Personal() {
    const { isLoading, data } = useRequestProfileQuery(undefined);
    if (isLoading) return <Loading />;
    if (typeof data === "undefined") return null;

    return (
        <div className={styles.page}>
            <Header title="个人信息" left={<Back />} />
            <ul className={styles.options}>
                {/* 头像 */}
                <Avatar avatar={data.data.photo} />
                {/* 昵称 */}
                <Nickname name={data.data.name} />
                {/* 用户简介 */}
                <Intro intro={data.data.intro} />
            </ul>
            <ul className={styles.options}>
                <Gender gender={data.data.gender} />

                <Birthday birthday={data.data.birthday} />

            </ul>
            <Logout />
        </div>
    );
}
